package com.bjesc_b2c.app.appraiset.widget.popupwindow;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.bjesc_b2c.app.appraiset.R;
import com.bjesc_b2c.app.appraiset.widget.BasePopupWindow;

/**
 * Created by lenovo on 2017/2/28.
 */

public class OrderOperationPop extends BasePopupWindow {
    private LinearLayout ll_defeat;
    private LinearLayout ll_put_sea;
    private LinearLayout ll_return;
    private LinearLayout ll_change_of_contract;
    private LinearLayout ll_move_order;
    private int showType;
    public OrderOperationPop(Context context, View.OnClickListener listener,int showType) {
        super(context, listener);
        this.showType = showType;
        goneOrVis(showType);
    }

    @Override
    protected void initViews() {
        view = inflater.inflate(R.layout.pop_order_operation,null);
        ll_defeat = (LinearLayout) view.findViewById(R.id.ll_defeat);
        ll_defeat.setOnClickListener(listener);
        ll_put_sea = (LinearLayout) view.findViewById(R.id.ll_put_sea);
        ll_put_sea.setOnClickListener(listener);
        ll_return = (LinearLayout) view.findViewById(R.id.ll_return);
        ll_return.setOnClickListener(listener);
        ll_change_of_contract = (LinearLayout) view.findViewById(R.id.ll_change_of_contract);
        ll_change_of_contract.setOnClickListener(listener);
        ll_move_order = (LinearLayout) view.findViewById(R.id.ll_move_order);
        ll_move_order.setOnClickListener(listener);
    }

    @Override
    protected void setView() {
        super.setView();
        this.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
        this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        this.setFocusable(true);

    }
    @Override
    protected int setRootViewId() {
        return R.id.root;
    }
   private void goneOrVis(int type){
       switch (type){
           case 1://未接单详情页
               ll_defeat.setVisibility(View.GONE);
               ll_put_sea.setVisibility(View.GONE);
               break;
           case 2://已确认到店时间
               ll_change_of_contract.setVisibility(View.GONE);
               ll_return.setVisibility(View.GONE);
               break;
           case 3://未确认到店时间
               ll_change_of_contract.setVisibility(View.GONE);
               ll_return.setVisibility(View.GONE);
               ll_move_order.setVisibility(View.GONE);
               break;
           case 4:
               break;
       }
       //获取自身的长宽高
       view.measure(View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
       popupHeight = view.getMeasuredHeight();
       popupWidth = view.getMeasuredWidth();
   }

}
